package com.yc.service.impl;

import com.yc.mapper.SchoolYearMapper;
import com.yc.vo.Result;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.security.PrivateKey;
import java.util.*;

/**
 * @author mqm
 * @version 1.0
 * @date 2023/8/2 18:14
 */
@RestController
public class SchoolYearServiceImpl {

    @Resource
    private SchoolYearMapper schoolYearMapper;

    /**
     * 查询学年 2023-2024
     * @return
     */
    public List<String> queryTerm(){
        List<String> list = schoolYearMapper.querySchoolYears();
        List<String> terms =new ArrayList<>();
        for (String s : list) {
            String substring = s.substring(0, 9);
            terms.add(substring);
        }
        //去重，保留顺序
        Set<String> sets =new LinkedHashSet<>(terms);
        List<String> term =new ArrayList<>(sets);
        return term;
    }
}
